<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>智慧校园发布平台</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="plugins/layui/css/layui.css">
    <script src="libs/jquery.min.js"></script>

    <script src="plugins/echarts/echarts.js"></script>

    <script src="plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="plugins/jqgrid/jquery.jqGrid.min.js"></script>
    <script src="plugins/ztree/jquery.ztree.all.min.js"></script>
    <script src="js/common.js"></script>
</head>
<body>


<div id="rrapp" v-cloak class="panel panel-default">
    <div id="tp-weather-widget" style="text-align: right;"></div>

    <div class="col-md-4" style="padding-left: 0px;">

    <div class="panel panel-success">
        <div class="panel-heading">
            <h3 class="panel-title">我的班级</h3>
        </div>
        <div class="panel-body">
            <div class="row form-inline ">

                <blockquote class="layui-elem-quote" ><label id="myClass"></label></blockquote>


            </div>
        </div>
    </div>

    <div class="panel panel-success">
        <div class="panel-heading">
            <h3 class="panel-title">任课表<span id="today"></span></h3>
        </div>
        <div class="panel-body">
            <div class="row form-inline ">

                <ul class="layui-timeline">
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <h3 class="layui-timeline-title">三一班</h3>
                            <p>
                            <ul>
                                <li>9:00-09:45 <em>语文</em></li>
                                <li>14:00-14:45 <em>语文</em></li>
                            </ul>
                            </p>
                        </div>
                    </li>
                    <li class="layui-timeline-item">
                        <i class="layui-icon layui-timeline-axis">&#xe63f;</i>
                        <div class="layui-timeline-content layui-text">
                            <h3 class="layui-timeline-title">三六班</h3>
                            <ul>
                                <li>10:00-10:45 <em>语文</em></li>

                            </ul>
                        </div>
                    </li>


                </ul>


            </div>
        </div>
    </div>


    <div class="panel panel-success">
        <div class="panel-heading">
            <h3 class="panel-title">今日班级考勤</h3>
        </div>
        <div class="panel-body">
            <div class="row form-inline">

                <div id="main" style="height:280px;"></div>

            </div>
        </div>
    </div>


    </div>

    <div class="col-md-8" style="padding-right: 0px;">

        <div class="panel panel-success">
            <div class="panel-heading">
                <h3 class="panel-title">本周工作安排</h3>
            </div>
            <div class="panel-body" style="padding-top: 0px;">
                <div class="row form-inline">

                    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="width: 50%;float: left;">
                        <ul class="layui-tab-title">
                            <li id="w1">周一</li>
                            <li id="w2">周二</li>
                            <li id="w3">周三</li>
                            <li id="w4">周四</li>
                            <li id="w5">周五</li>
                        </ul>
                        <div class="layui-tab-content">

                            <div class="layui-tab-item" id="week1">1</div>
                            <div class="layui-tab-item" id="week2">2</div>
                            <div class="layui-tab-item" id="week3">3</div>
                            <div class="layui-tab-item" id="week4">4</div>
                            <div class="layui-tab-item" id="week5">5</div>

                        </div>
                    </div>

                    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief" style="width: 50%;float: right;">
                        <ul class="layui-tab-title">
                            <li class="layui-this">本周主要工作</li>
                            <li>备注</li>
                        </ul>
                        <div class="layui-tab-content">

                            <div class="layui-tab-item layui-show" id="weekPlan"></div>
                            <div class="layui-tab-item" id="weekRemark"></div>

                        </div>
                    </div>

                </div>
            </div>
        </div>

        <div class="panel panel-success">
            <div class="panel-heading">
                <h3 class="panel-title">通知公告</h3>
            </div>
            <div class="panel-body">
                <div class="row form-inline">

                    <ul class="layui-timeline" id="noticeList">


                    </ul>

                </div>
            </div>
        </div>

       <!-- <div class="panel panel-success">
            <div class="panel-heading">
                <h3 class="panel-title">任课表</h3>
            </div>
            <div class="panel-body">
                <div class="row form-inline">


                </div>
            </div>
        </div>-->


    </div>




</div>
</body>
<script src="plugins/layui/layui.all.js"></script>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    // 指定图表的配置项和数据
    var option = {
        title : {
            text: '今日考勤',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: ['已到','缺勤','迟到']
        },
        series : [
            {
                name: '刷卡统计',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[
                    {value:45, name:'已到'},
                    {value:2, name:'缺勤'},
                    {value:2, name:'迟到'}
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };


    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>

<script>(function(T,h,i,n,k,P,a,g,e){g=function(){P=h.createElement(i);a=h.getElementsByTagName(i)[0];P.src=k;P.charset="utf-8";P.async=1;a.parentNode.insertBefore(P,a)};T["ThinkPageWeatherWidgetObject"]=n;T[n]||(T[n]=function(){(T[n].q=T[n].q||[]).push(arguments)});T[n].l=+new Date();if(T.attachEvent){T.attachEvent("onload",g)}else{T.addEventListener("load",g,false)}}(window,document,"script","tpwidget","//widget.seniverse.com/widget/chameleon.js"))</script>
<script>tpwidget("init", {
    "flavor": "slim",
    "location": "WTSQQYHVQ973",
    "geolocation": "enabled",
    "language": "zh-chs",
    "unit": "c",
    "theme": "chameleon",
    "container": "tp-weather-widget",
    "bubble": "enabled",
    "alarmType": "badge",
    "uid": "UE8CF7DA4F",
    "hash": "cb83603e2c43c4a38a1115e1c458b1ad"
});
tpwidget("show");</script>
</html>


<script>

    var now = new Date(); //当前日期
    var nowDayOfWeek = now.getDay();
    var month=now.getMonth()+1;
    var date=now.getDate();
    var day=now.getDay();


    $("#today").html(month+"月"+date+"日，星期"+nowDayOfWeek);

    $.ajax({
        type: "POST",
        url: baseURL + "base/courseinfo/getMyClass",
        success: function(r){
            if(r.code == 0){

                var classText='';
                for (var i=0;i<r.courseInfoList.length;i++){
                    classText += r.courseInfoList[i].className+' ';
                }
                $("#myClass").html(classText);
            }else{

            }
        }
    });

    var weekDate=getTime(0);

    $.ajax({
        type: "POST",
        url: baseURL + "base/workplan/getWeekPlan",
        data: {"weekDate":weekDate},
        success: function(r){
            if(r.code == 0){
                $("#week1").html(r.workPlanInfoEntity[0].dayPlan);
                $("#week2").html(r.workPlanInfoEntity[1].dayPlan);
                $("#week3").html(r.workPlanInfoEntity[2].dayPlan);
                $("#week4").html(r.workPlanInfoEntity[3].dayPlan);
                $("#week5").html(r.workPlanInfoEntity[4].dayPlan);

                $("#weekPlan").html(r.workPlanEntity.weekPlan);
                $("#weekRemark").html(r.workPlanEntity.remark);



               /* alert(777)
                */
                $("#w"+nowDayOfWeek).attr("class", "layui-this");

                $("#week"+nowDayOfWeek).addClass( "layui-show");

            }else{

            }
        }
    });


    $.ajax({
        type: "POST",
        url: baseURL + "base/noticeinfo/getTop5List",
        success: function(r){
            if(r.code == 0){
               console.log(r)

                var noticeList='';

               for(var i=0;i<r.noticeInfo.length;i++){

                   noticeList+='<li class="layui-timeline-item">';
                   noticeList+='<i class="layui-icon layui-timeline-axis">&#xe63f;</i>';
                   noticeList+='<div class="layui-timeline-content layui-text">';
                   noticeList+='<h3 class="layui-timeline-title">'+r.noticeInfo[i].gmtCreat+'</h3>';
                   noticeList+='<p>';
                   noticeList+= r.noticeInfo[i].theme;
                   noticeList+= r.noticeInfo[i].content;
                   noticeList+=' </p>';
                   noticeList+=' </div>';
                   noticeList+='</li>';

               }

               $("#noticeList").html(noticeList);

            }else{

            }
        }
    });


    function getTime(n){
        var now=new Date();
        var year=now.getFullYear();
        //因为月份是从0开始的,所以获取这个月的月份数要加1才行
        var month=now.getMonth()+1;
        var date=now.getDate();
        var day=now.getDay();
        console.log(date);
        //判断是否为周日,如果不是的话,就让今天的day-1(例如星期二就是2-1)
        if(day!==0){
            n=n+(day-1);
        }
        else{
            n=n+day;
        }
        if(day){
            //这个判断是为了解决跨年的问题
            if(month>1){
                month=month;
            }
            //这个判断是为了解决跨年的问题,月份是从0开始的
            else{
                year=year-1;
                month=12;
            }
        }
        now.setDate(now.getDate()-n);
        year=now.getFullYear();
        month=now.getMonth()+1;
        date=now.getDate();
        console.log(n);
        s=year+"-"+(month<10?('0'+month):month)+"-"+(date<10?('0'+date):date);
        return s;
    }
</script>


